/*
 * @(#)RuntimeInterceptorConfig.java $version 2010. 8. 11
 *
 * Copyright 2007-2010 NHN Corp. All rights Reserved. 
 * NHN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.nhncorp.usf.core.config.runtime;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import com.nhncorp.usf.core.config.InterceptorConfigAware;

/**
 * @author Web Platform Development Team
 */
public class RuntimeInterceptorConfig implements InterceptorConfigAware {
    private String name;
    private Map<String, String> params;

    /**
     * @see com.nhncorp.usf.core.config.InterceptorConfigAware#setName(java.lang.String)
     * {@inheritDoc}
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @see com.nhncorp.usf.core.config.InterceptorConfigAware#getName()
     * {@inheritDoc}
     */
    public String getName() {
        return name;
    }

    /**
     * Adds the param.
     *
     * @param name  the name
     * @param value the value
     */
    public void addParam(String name, String value) {
        if (params == null) {
            params = new HashMap<String, String>();
        }

        params.put(name, value);
    }

    /**
     * Gets the param.
     *
     * @param name the name
     * @return the param
     */
    public String getParam(String name) {
        return (params == null) ? null : params.get(name);
    }

    /**
     * Sets the params.
     *
     * @param params the params
     */
    public void setParams(Map<String, String> params) {
        this.params = params;
    }

    /**
     * Instantiates a new runtime interceptor config.
     *
     * @param name the name
     */
    public RuntimeInterceptorConfig(String name) {
        this.name = name;
    }

    /**
     * Gets the params.
     *
     * @return the params
     */
    public Map<String, String> getParams() {
        if (params == null) {
            return Collections.emptyMap();
        }

        return params;
    }
}
